<?php
class Login_Data_Usercheckout implements Login_Data_Mainbale{
    
    private $core_controller_selectdata;
    private $login_data_getaccesslevel;
    
    public function __construct() {
        $this->core_controller_selectdata = new Core_Controller_Selectdata;
        $this->login_data_getaccesslevel = new Login_Data_Getaccesslevel;
    }
    public function main(array $variables = null) {
        $variables['query'] = "SELECT username, access_level FROM account_settings WHERE email='".$variables['post']['email']."' AND password='".sha1($variables['post']['password'])."' AND status_name='Aktywny';";
        //var_dump($variables);
        
        //die();
        $userdata = $this->core_controller_selectdata->main($variables);
        //var_dump($userdata);
        //die();
        $_SESSION['username'] = $userdata['0']['0'];
        $access_level = $this->login_data_getaccesslevel->main($userdata);
        //var_dump($access_level);
        //die();
        $_SESSION['access_level'] = $access_level['0']['0'];
    }

}
